package org.ligson.httptest;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.io.IOUtils;

import java.io.File;
import java.io.FileInputStream;

public class GitJson {
    public static void main(String[] args) throws Exception{
        File file = new File("/Users/lijinsheng/Downloads/git.json");
        String json = IOUtils.toString(new FileInputStream(file),"UTF-8");
        ObjectMapper mapper =new ObjectMapper();
        JsonNode root = mapper.readTree(json);
        JsonNode projects = root.get("projects");
        for (JsonNode project : projects) {
            System.out.println("cd "+project.get("name").asText());
            System.out.println("git clone "+project.get("http_url_to_repo").asText());
            System.out.println("cd ..");
        }
    }
}
